﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Employee/MasterPageEmployee.master" AutoEventWireup="true" CodeFile="CreateVacancy.aspx.cs" Inherits="Employee_CreateVacancy" %>

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <script type="text/javascript" src="../Scripts/jquery.js"></script>
    <script type="text/javascript">
        $(function () {
            $('#<%=ddlTypeJob.ClientID %>').blur(function () {
                if ($('#<%=ddlTypeJob.ClientID %>').val() == "Please choise Type of work") {
                    $('#<%=lblTypeofworkError.ClientID %>').html("(*)");
                    HidebtnCreate();
                }
                else {
                    $('#<%=lblTypeofworkError.ClientID %>').html("");
                    HidebtnCreate();
                }
            });
            $('#<%=txtDecription.ClientID %>').blur(function () {
                if ($('#<%=txtDecription.ClientID %>').val() == "") {
                    $('#<%=lblDescriptError.ClientID %>').html("(*)");
                    HidebtnCreate();
                }
                else {
                    $('#<%=lblDescriptError.ClientID %>').html("");
                    HidebtnCreate();
                }
            });
            $('#<%=txtNumberofJob.ClientID %>').blur(function () {
                if ($('#<%=txtNumberofJob.ClientID %>').val() == "") {
                    $('#<%=lblNumber.ClientID %>').html("(*)");
                    HidebtnCreate();
                }
                else {
                    $('#<%=lblNumber.ClientID %>').html("");
                    HidebtnCreate();
                }
            });
            $('#<%=txtDateFilfilled.ClientID %>').blur(function () {
                if ($('#<%=txtDateFilfilled.ClientID %>').val() == "") {
                    $('#<%=lblDateError.ClientID %>').html("(*)");
                    HidebtnCreate();
                }
                else {
                    $('#<%=lblDateError.ClientID %>').html("");
                    HidebtnCreate();
                }
            });
            $('#<%=txtTitle.ClientID %>').blur(function () {
                if ($('#<%=txtTitle.ClientID %>').val() == "") {
                    $('#<%=lblTitleError.ClientID %>').html("(*)");
                    HidebtnCreate();
                }
                else {
                    $('#<%=lblTitleError.ClientID %>').html("");
                    HidebtnCreate();
                }
            });

            $('#<%=txtSalary.ClientID %>').blur(function () {
                if ($('#<%=txtSalary.ClientID %>').val() == "") {
                    $('#<%=lblErrorSalary.ClientID %>').html("(*)");
                    HidebtnCreate();
                }
                else {
                    $('#<%=lblErrorSalary.ClientID %>').html("");
                    HidebtnCreate();
                }
            });
            $('#<%=txtAddress.ClientID %>').blur(function () {
                if ($('#<%=txtAddress.ClientID %>').val() == "") {
                    $('#<%=lblErrorAddress.ClientID %>').html("(*)");
                    HidebtnCreate();
                }
                else {
                    $('#<%=lblErrorAddress.ClientID %>').html("");
                    HidebtnCreate();
                }
            });
            function HidebtnCreate() {
                if ($('#<%=ddlTypeJob.ClientID %>').val() == "Please choise Type of work") {
                    $('#<%=btnCreate.ClientID %>').attr('disabled', true);
                }
                else if ($('#<%=txtDecription.ClientID %>').val() == "") {
                    $('#<%=btnCreate.ClientID %>').attr('disabled', true);
                }
                else if ($('#<%=txtNumberofJob.ClientID %>').val() == "") {
                    $('#<%=btnCreate.ClientID %>').attr('disabled', true);
                }
                else if ($('#<%=txtDateFilfilled.ClientID %>').val() == "") {
                    $('#<%=btnCreate.ClientID %>').attr('disabled', true);
                }
                else if ($('#<%=txtTitle.ClientID %>').val() == "") {
                    $('#<%=btnCreate.ClientID %>').attr('disabled', true);
                }
                else if ($('#<%=txtSalary.ClientID %>').val() == "") {
                    $('#<%=btnCreate.ClientID %>').attr('disabled', true);
                }
                else if ($('#<%=txtAddress.ClientID %>').val() == "") {
                    $('#<%=btnCreate.ClientID %>').attr('disabled', true);
                }
                else {
                    $('#<%=btnCreate.ClientID %>').attr('disabled', false);
                }
            }
        });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="contentmain" Runat="Server">
    <div id="MainCreateVacancy">
        <h2>Create a new Vacancy</h2>
        <p>
            <asp:Label ID="lblTypeOfWork" runat="server" Text="Type of work:" Height="20px" 
                Width="180px"></asp:Label>
            <asp:DropDownList ID="ddlTypeJob" runat="server" 
                CssClass="CVinput" Height="20px" Width="204px">
                <asp:ListItem Selected="True">Please choise Type of work</asp:ListItem>
            </asp:DropDownList>
            <asp:Label ID="lblTypeofworkError" runat="server" ForeColor="Red"></asp:Label>
        </p>
        <p>
            <asp:Label ID="lblTitle" runat="server" Text="Title Vacancy:" Height="20px" 
                Width="180px"></asp:Label>
            <asp:TextBox ID="txtTitle" runat="server" Width="200px"></asp:TextBox>
            <asp:Label ID="lblTitleError" runat="server" ForeColor="Red"></asp:Label>
        </p>
        <p>
            <asp:Label ID="lblDescription" runat="server" Text="Description:" Height="20px" 
                Width="180px"></asp:Label>
            <asp:TextBox ID="txtDecription" runat="server" TextMode="MultiLine" 
                CssClass="CVinput" Height="40px" Width="202px"></asp:TextBox>
            <asp:Label ID="lblDescriptError" runat="server" ForeColor="Red"></asp:Label>
        </p>
        <p>
            <asp:Label ID="lblNumberofJob" runat="server" Text="Number needed to hire:" 
                Height="20px" Width="180px"></asp:Label>
            <asp:TextBox ID="txtNumberofJob" runat="server" CssClass="CVinput" 
                Height="20px" Width="200px"></asp:TextBox>
            <asp:Label ID="lblNumber" runat="server" ForeColor="Red"></asp:Label>
        </p>
        <p>
            <asp:Label ID="lblSalary" runat="server" Text="Salaries:" Height="20px" 
                Width="180px"></asp:Label>
            <asp:TextBox ID="txtSalary" runat="server" Width="200px"></asp:TextBox>
            <asp:Label ID="lblErrorSalary" runat="server" ForeColor="Red"></asp:Label>
        </p>
        <p>
            <asp:Label ID="lblWorkplace" runat="server" Text="Address workplase:" 
                Width="180px"></asp:Label>
            <asp:TextBox ID="txtAddress" runat="server" Width="200px"></asp:TextBox>
            <asp:Label ID="lblErrorAddress" runat="server" ForeColor="Red"></asp:Label>
        </p>
        <p>
            <asp:Label ID="lblDateCreation" runat="server" Text="Date Creation:" 
                Height="20px" Width="180px"></asp:Label>
            <asp:TextBox ID="txtDateCreation" runat="server" CssClass="CVinput" 
                Width="200px" Enabled="False"></asp:TextBox>
        </p>
        <p>
            <asp:Label ID="DateFylfilled" runat="server" Text="Date Fulfilled:" 
                Height="20px" Width="180px"></asp:Label>
            <asp:TextBox ID="txtDateFilfilled" runat="server" CssClass="CVinput" 
                Width="200px"></asp:TextBox>
            <asp:CalendarExtender ID="txtDateFilfilled_CalendarExtender" runat="server" 
                TargetControlID="txtDateFilfilled">
            </asp:CalendarExtender>
            <asp:Label ID="lblDateError" runat="server" ForeColor="Red"></asp:Label>
        </p>
        <p>
            <asp:Label ID="lblStatus" runat="server" Text="Status:" Height="20px" 
                Width="180px"></asp:Label>
            <asp:DropDownList ID="ddlStatus" runat="server" CssClass="CVinput" 
                Height="20px" Width="100px" Enabled="False">
                <asp:ListItem Selected="True">On</asp:ListItem>
            </asp:DropDownList>
        </p>
        <p style="text-align: center;"><asp:Label ID="lblError" runat="server" Text="" ForeColor="Red"></asp:Label>
            <asp:Label ID="lblSuccess" runat="server" ForeColor="Blue"></asp:Label>
            <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
            </asp:ToolkitScriptManager>
        </p>
        <p id="button">
            <asp:Button ID="btnCreate" runat="server" Text="Create" Height="30px" 
                Width="100px" onclick="btnCreate_Click" ToolTip="Create new Vacancy" />
            <asp:Button ID="btnClear" runat="server" Text="Clear" Height="30px" 
                Width="100px" onclick="btnClear_Click" ToolTip="Clear all textbox" />
        </p>
    </div>
</asp:Content>

